/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */




////////////////////////////////////


function NefertiteController(){
    this.loadMap = function(latitude,longitude){
        url = "http://maps.google.com/?ie=ISO8859-1&ll=" + latitude + "," + longitude + "&spn=" + latitude + "," + longitude + "&z=10&output=embed";
        //alert(url);
        //this.loadWindow(url, "Google MAP - Geolocation");
        document.getElementById("cframeMap").style.height="600px";
        document.getElementById("cframeMap").src = url;
    }
    this.loadWindow = function(win,tit){
        $.ui.dialog.defaults.bgiframe = true;
        $(function() {
            $("#dialog").dialog({
                width: 640,
                height: 480,
                top: 15,
                modal: true

            });
        });
        document.getElementById("cframeDialog").src=win;
        $("#dialog").dialog('option', 'title', tit);
        $("#dialog").dialog('open')
    }

    this.closeWindow = function(){
        $("#dialog").dialog('close');
    }
    this.reloadMainWin=function(){
        document.location = document.location.href;
    }

    this.showLoadingDiv = function(){
        //        alert('asd');
        var divTag = document.createElement("div");
        divTag.id = "div1";
        divTag.setAttribute("align","center");
        divTag.style.margin = "0px auto";
        divTag.className ="dynamicDiv";

        //        divTag.innerHTML = "<p><p><p><p><p><p><p><center><img style='vertical-align: middle;' src='images/11.gif'><br>LOADING....</center>";
        var divLoad = document.createElement("div");
        divLoad.id = "divLoad";
        divLoad.setAttribute("align","center");
        divLoad.style.margin = "0px auto";
        divLoad.innerHTML = "<center><img style='vertical-align: middle;' src='images/11.gif'><br>LOADING....</center>";
        divLoad.className ="loadIcon";

        document.body.appendChild(divTag);
        document.body.appendChild(divLoad);

        document.body.scroll = 'no'; //hide IE
        document.body.style.overflow='hidden' //Firefox
    }

    this.hideLoading = function(){
        try{
            document.getElementById('div1').style.visibility = 'hidden';
            document.getElementById('divLoad').style.visibility = 'hidden';
        }catch(e){
        ///Does nothing
        }
    }

    this.crawlerThread = function(){
        this.showLoadingDiv();
        var url = prompt("Enter seed address. Ex: http://rss.xxx.com");
        if(url!=""){
            document.location = "PinoController.do?method=searchWeb&url="+escape(url);
        }else{
            this.hideLoading();
        }

    }
    this.createDiv = function(){
        var divTag = document.createElement("div");
        divTag.id = "dialog";
        divTag.setAttribute("align","center");
        divTag.style.margin = "0px auto";
        divTag.innerHTML = "<iframe id=\"cframeDialog\" width=\"100%\" height=\"100%\" frameborder=\"0\"></iframe>";

        document.body.appendChild(divTag);

    }
}
//Controla a nefertite
var nefertiteController = new NefertiteController();

window.onunload = function(){
    nefertiteController.showLoadingDiv();
}

window.onload=function(){
    nefertiteController.createDiv();
    //google.load("maps", "2");
    //google.setOnLoadCallback(initialize);
    $(function(){

        // Accordion
        $("#accordion").accordion({
            header: "h3"
        });

    })

    //nefertiteController.loadMap();
}

